package org.huatek.anders.rabbitmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author anders
 * @date 2018-11-15 14:12
 * 添加creditBank()方法，监听routingKey为credit.bank的队列消息
 * 添加creditFinance()方法，监听routingKey为credit.finance的队列消息
 **/
@Component
@Slf4j
public class ApiCreditReceive {
    @RabbitHandler
    @RabbitListener(queues = "credit.bank")
    public void creditBank(String msg) {
        log.info("credit.bank receive message: "+msg);
    }

    @RabbitHandler
    @RabbitListener(queues = "credit.finance")
    public void creditFinance(String msg) {
        log.info("credit.finance receive message: "+msg);
    }
}
